package com.wangzemin.leetcoded.num1560;

import java.util.ArrayList;
import java.util.List;

class Solution {
    public List<Integer> mostVisited(int n, int[] rounds) {
        List<Integer> maxRounds = new ArrayList<Integer>();

        int begin = rounds[0];
        int end = rounds[rounds.length - 1];
        if (begin <= end) {
            for (int i = begin; i <= end; i++) {
                maxRounds.add(i);
            }
        } else {
            for (int i = 1; i <= end; i++) {
                maxRounds.add(i);
            }
            for (int i = begin; i <= n; i++) {
                maxRounds.add(i);
            }

        }
        return maxRounds;
    }
}